﻿module Enferno.Public.Web.Components.Knockout {
    
    export class Basket {

        public static init(bindingDomNodeSelector?: string): JQueryPromise<void> {
            return Controllers.Knockout.BasketController.init(null, bindingDomNodeSelector);
        }

        public static registerOnInitilizedFn(fn: Controllers.Base.IOnBasketInitilizedFunction) {
            Controllers.Knockout.BasketController.onInitializedFunctions.push(fn);
        }

    }

    export class Product {

        public static init(data: any, parametricIdsRenderedExplicitly: Array<number>, bindingDomNodeSelector?: string): void {
            Controllers.Knockout.ProductController.init(data, parametricIdsRenderedExplicitly, bindingDomNodeSelector);
        }

        public static registerOnInitilizedFn(fn: Controllers.Base.IOnProductInitilizedFunction) {
            Controllers.Base.ProductControllerBase.onInitializedFunctions.push(fn);
        }
    }

    export class Checkout {

        public static init(): JQueryPromise<void>;
        public static init(basketController: Controllers.Knockout.BasketController): JQueryPromise<void>;
        public static init(basketController: Controllers.Knockout.BasketController, bindingDomNodeSelector: string): JQueryPromise<void>
        public static init(basketController?: Controllers.Knockout.BasketController, bindingDomNodeSelector?: string): JQueryPromise<void>{
            return Controllers.Knockout.CheckoutController.init(basketController, bindingDomNodeSelector);
        }

        public static registerOnInitilizedFn(fn: Controllers.Base.IOnCheckoutInitilizedFunction) {
            Controllers.Base.CheckoutControllerBase.onInitializedFunctions.push(fn);
        }
    }

}